// @mxmlc -library-path+=lib
/**
* @author maze | guavestudios.com
* @license MIT License see LICENSE.TXT
* @version 0.1
*/

package {
	import com.adobe.crypto.SHA256;
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;

	public class LockManagerHashGenerator extends Sprite {
		
		private var input:TextField;
		private var generate:Sprite;
		private var output:TextField;
		public function LockManagerHashGenerator() {
			
			input=new TextField();
			input.border=true;
			input.type = TextFieldType.INPUT;
			input.width = 95;
			input.height = 20;
			
			generate=new Sprite();
			generate.x=100;
			var g:Graphics=generate.graphics;
			g.beginFill(0xFF0000);
			g.drawRect(0,0,40,20);
			g.endFill();
			generate.buttonMode=true;
			generate.addEventListener(MouseEvent.CLICK,generate_click);
			
			output=new TextField();
			output.autoSize=TextFieldAutoSize.LEFT;
			output.border = true;
			output.y = 40;
			addChild(input);
			addChild(generate);
			addChild(output);
		}
		private function generate_click(e:MouseEvent)
		{
			output.text=SHA256.hash(input.text);
		}
		
	}
	
}
